<template>
	<view>
		<uni-section title="面试列表" type="line"></uni-section>
		<view class="example-body" v-for='(item,index) in list' :key='index'>
			<view class="example-box">
				<uni-card :title="item.companyname" :isFull="true" isShadow='true' :note="'hr电话：'+item.phone"
					:extra="item.salary" @click="clickCard(item.id)">
					<view class="content-box-text">
						面试时间：{{item.timeview}}
					</view>
<!-- 					<view class="content-box-text">
						面试地点：{{item.location}}
					</view> -->
					<view class="content-box-text">
						面试要求：{{item.info}}
					</view>
				</uni-card>
			</view>
		</view>

	</view>
</template>

<script>
	export default {
		data() {
			return {
				list: [{
					companyname: '',
					salary: '',
					phone: '',
					info: '',
					timeview: '',
					location: '',
				}]
			}
		},
		// onLoad() { //只加载一次
		// 	this.getlist()
		// },
		onShow(){ 
			//触发多次
			this.getlist()
		},
		methods: {
			getlist() {
				uni.request({
					url: 'http://39.106.207.209:8100/interview/getInterviewAll',
					method: 'get',
					success: (res) => {
						this.list = res.data.data
					}
				});
			},
			clickCard(id) {
				uni.request({
					url: 'http://39.106.207.209:8100/interview/getInterviewById/' + id,
					method: 'get',
					success: (res) => {
						let obj = res.data.data
						uni.navigateTo({
							url: '/pages/details/details?obj=' + encodeURIComponent(JSON.stringify(
								obj))
						});

					}
				})
			}
		}

	}
</script>

<style lang="scss">
	@import '@/common/uni-nvue.scss';
</style>
